<h1><?php echo $title;?></h1>
<?php if(isset($row['aid'])) : ?>
<?php if($row['username'] == $this->user->username || $this->user->level['album'] >= LEVEL_ADD) : ?>
<div class='adminbox'>
<?php echo anchor('album/sary/ampidiro/' . $row['aid'], __("Add photo", "album")) ?>
 | <?php echo anchor('album/import_flickr/import/' . $row['aid'], __("Import from flickr", "album")) ?>
<?php if($row['username'] == $this->user->username || $this->user->level['album'] >= LEVEL_DEL) : ?>
  | <?php echo anchor('album/fafao/' . $row['aid'], __("Delete album", "album")) ?>
<?php endif; ?>

</div>
<?php endif; ?>

<?php endif; ?>

		<?php if (isset($error)) :?>
		<p class="error">
		<?php foreach ($error as $key => $val) : ?>
		<?php echo $val ?> <br />
		<?php endforeach; ?>
		</p>
		<?php endif; ?>

<form  enctype="multipart/form-data" class="edit" action="<?php echo site_url('album/ampidiro')?>" method="post" accept-charset="utf-8">
		<input type="hidden" name="aid" value="<?php echo (isset($row['aid'])?$row['aid'] : "") ?>" />
	

		<?php if ($notice = $this->session->flashdata('notification')):?>
		<p class="notice"><?php echo $notice;?></p>
		<?php endif;?>
		
		<label for="title"><?php echo __("Album name:", $module)?> </label>
		<input type="text" name="title" value="<?php echo (isset($row['title'])?$row['title'] : "")  ?>" id="tags" class="input-text" /><br />

		<label for="description"><?php echo __("Description:", $module)?></label>
		<textarea name="description" class="input-textarea" style="height: 100px"><?php echo (isset($row['description'])?$row['description'] : "") ?></textarea><br />

		<label for="g_id"><?php echo __("Access:", $module)?> </label>
		<select name="g_id" id="groups" class="select">
		<?php foreach ($groups as $group): ?>
			<option value="<?php echo $group['g_id'] ?>" <?php if (isset($row['g_id']) && ($group['g_id'] == $row['g_id'])) echo "selected" ?> ><?php echo __($group['g_name'], $module) ?></option>
		<?php endforeach; ?> 
		</select>
		<br />

		<label for="tags"><?php echo __("Tags", $this->template['module'])?>:</label>
		<i><?php echo __("Separate tags with comma", $this->template['module']) ?></i><br />
		
		<input type="text" name="stag" value="<?php 
		if (isset($row['tags']) && is_array($row['tags']))
		{
		
			$i = 0;
			foreach ($row['tags'] as $t)
			{
				if ($i > 0)  echo ", "; 
				echo str_replace('"', '', $t['tag']);
				$i++;
			}
		}
		if (isset($row['stag']))
		{
			echo $row['stag'];
		}
		?>" id="tags" class="input-text" /><br />
		
		<?php if($tags) : ?>
		<?php echo __("or choose from these", $this->template['module'])?>
		<table border=0><tr>
		<?php $col = 1; foreach ($tags as $tag): ?>
		<td valign='top'><input class="input-checkbox" type='checkbox' name='tags[]' value="<?php echo $tag['tag'] ?>" ><?php echo $tag['tag'] ?></td>
      
			<?php if($col % 4 == 0): ?>
			</tr><tr>
			<?php endif; ?>
		<?php $col++; endforeach; ?>
		</tr></table>
		<br />
		<?php endif; ?>
		
<?php if(isset($sary) && $sary !== false): ?>
<br />
		<input type="submit" name="submit" value="<?php echo __("Save", $this->template['module'])?>" class="input-submit" />
		<a href="<?php echo site_url( $this->session->userdata("last_uri") )?>" class="input-submit"><?php echo __("Cancel", $this->template['module'])?></a>
		
<h1><?php echo __("Edit photo details", "album") ?></h1>
<?php foreach($sary as $s) : ?>
<div class="photo" style="margin-bottom: 10px">
<div style="float: left; width: 100px">
<img src="<?php echo $s['t'] ?>"><br >
<input type="radio" name="cover" value="<?php echo $s['s'] ?>"> 
<?php echo __("Album cover", "album") ?><br />
<input type="checkbox" name="image_delete[<?php echo $s['sid'] ?>]" value="1">
<?php echo __("Delete", "album") ?>
</div>
<div style="float: right; width: 500px">
<label for="image_title[<?php echo $s['sid'] ?>]"><?php echo __("Title", "album") ?></label>
<input type="text" name="image_title[<?php echo $s['sid'] ?>]" value="<?php echo $s['title'] ?>" class="input-text"><br />
<label for="image_description[<?php echo $s['sid'] ?>]"><?php echo __("Description", "album") ?></label>
<textarea name="image_description[<?php echo $s['sid'] ?>]" class="input-textarea" style="height: 100px"><?php echo $s['description'] ?></textarea>
</div>
<div class="clear"></div>
</div>
<?php endforeach; ?>
<div class="clear"></div>
<?php endif; ?>		
		
		<input type="submit" name="submit" value="<?php echo __("Save", $this->template['module'])?>" class="input-submit" />
		<a href="<?php echo site_url( $this->session->userdata("last_uri") )?>" class="input-submit"><?php echo __("Cancel", $this->template['module'])?></a>

		</form>
